public class LC165M {

    public int compareVersion(String version1, String version2) {
        String[] s1=version1.split("\\.");
        String[] s2=version2.split("\\.");
        int n=Math.min(s1.length, s2.length);
        for (int i = 0; i < n; i++) {
            int x=Integer.parseInt(s1[i]);
            int y=Integer.parseInt(s2[i]);
            if (x>y)
                return 1;
            else if (x<y)
                return -1;

        }
        int m;
        if (s1.length> s2.length){
            m=s1.length;
            for (int i = n; i < m; i++) {
                if (Integer.parseInt(s1[i])>0)
                    return 1;
            }
        }
        else if (s1.length< s2.length){
            m=s2.length;
            for (int i=n;i<m;i++){
                if (Integer.parseInt(s2[i])>0){
                    return -1;
                }
            }
        }
        return 0;
    }

    public static void main(String[] args) {
        String version1="1.0.02.0";
        String version2="1.0.2";
        System.out.println(new LC165M().compareVersion(version1,version2));
    }

}
